# coding:utf-8
import threading,Queue
from requests import *

q = Queue.Queue()
def CS():
	while not q.empty():
		try:
			pr = q.get(True, 1)
			#print proxy
		except:
			# ur3.task_done()
			break
		proxies = {"https": pr}
		headers = {
			"Host": "www.ipip.net",
			"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:56.0) Gecko/20100101 Firefox/56.0",
			"Accept": "*/*",
			"Accept-Language": "en-US,en;q=0.5",
			"Accept-Encoding": "gzip, deflate",
			"Referer": "https://www.ipip.net/"
		}
		url = 'https://www.ipip.net'
		try:
			html = get(url, timeout=10, headers=headers, proxies=proxies)
			if html.status_code == 200:
				print 'HTTP suss==='+pr
				new_url = open("suss.txt", "ab+")
				new_url.write(pr +'\n')
				#proxy = proxy.split('https://')[1]
		except Exception,e:
			print ''

for pr in open("2.txt"):
	pr = pr.replace('\n', '')
	q.put(pr)
ts = []
for i in xrange(10):
	t = threading.Thread(target=CS)
	t.start()
	ts.append(t)
for t in ts:
	t.join()
